package org.jeecg.modules.cascv.image.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Mapper
@Component
public interface ShiYanCangSqlDaoMapper {
    @Select("select MAX(ID) FROM GDQV_XML")
    Integer xmlMaxId();

    @Select("SELECT * from GDQV_XML where XML_NAME=#{NAME}")
    Boolean xmlIs(@Param("NAME") String NAME);

    @Select("select MAX(ID) FROM GDQV_PARA")
    Long paraMaxId();

    void addXmlSql(Map<String, Object> map);

    void addParmSql(Map<String, Object> map);

    @Select("select PARA_CODE from GDQV_PARA a LEFT JOIN gdqv_xml b ON b.id=a.xml_id where b.XML_NAME=#{xmlName}")
    List<String> getParaCodeByXMlName(String xmlName);

    @Select("delete from GDQV_PARA where PARA_CODE=#{PARA_CODE}")
    void removeUnusedParam(@Param("PARA_CODE")String PARA_CODE);

    @Update("UPDATE GDQV_PARA SET PARA_NAME=#{PARA_NAME},UNIT=#{UNIT},BINARY_CODE=#{BINARY_CODE} where PARA_CODE=#{PARA_CODE}")
    void updateParam(@Param("PARA_NAME")String PARA_NAME,@Param("UNIT")String UNIT,@Param("BINARY_CODE")Integer BINARY_CODE,@Param("PARA_CODE")String PARA_CODE);
}
